Skip to content

feat(scout-url): parametro --user-agent configurabile#68

Merged
matteocavo merged 2 commits intomainfrom
feat/scout-url-user-agent
Mar 25, 2026
Merged

feat(scout-url): parametro --user-agent configurabile#68
matteocavo merged 2 commits intomainfrom
feat/scout-url-user-agent

Conversation

@Gabrymi93
Copy link
Copy Markdown
Member

Cosa cambia

Aggiunge il parametro --user-agent al comando toolkit scout-url.

Diversi portali istituzionali italiani (ACI, MEF DAG, Ministero Salute) bloccano richieste con User-Agent non standard restituendo 403 o 404 fittizi, rendendo impossibile verificare accesso e formato senza aprire il browser manualmente.

Modifica

  • probe_url() accetta ora user_agent come parametro (default invariato: dataciviclab-toolkit/scout-url)
  • Il comando CLI espone --user-agent con lo stesso default — nessuna breaking change
# comportamento invariato
toolkit scout-url https://example.com/data.csv

# nuovo: UA personalizzato per portali che bloccano bot
toolkit scout-url https://example.com/data.csv --user-agent "Mozilla/5.0"

Test

4 test esistenti passano senza modifiche.

Closes #67

@Gabrymi93 Gabrymi93 requested a review from matteocavo March 24, 2026 19:21
matteocavo
matteocavo previously approved these changes Mar 24, 2026
Copy link
Copy Markdown
Contributor

@matteocavo matteocavo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nota minore, non bloccante:

non c’è ancora un test che verifichi esplicitamente il passaggio di un --user-agent custom fino a requests.get, quindi la nuova feature ha copertura indiretta ma non diretta.
Verdetto:

nessun finding HIGH/CRITICAL
approvabile

@Gabrymi93
Copy link
Copy Markdown
Member Author

Implementato il test unitario richiesto da @matteocavo. Il nuovo test est_probe_url_passes_custom_user_agent verifica che il parametro user_agent arrivi correttamente a
equests.get. Tutti i 5 test di est_cli_scout_url.py passano localmente.

Copy link
Copy Markdown
Contributor

@matteocavo matteocavo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non ho trovato blocker su toolkit#68.

Verifica fatta:

diff coerente: il nuovo --user-agent passa dalla CLI a probe_url() senza cambiare il default
test mirati verdi:
.\.venv\Scripts\python.exe -m pytest tests\test_cli_scout_url.py -q
esito: 4 passed
In più, ora c’è anche il test giusto sul nuovo comportamento:

test_probe_url_passes_custom_user_agent in test_cli_scout_url.py
Verdetto:

nessun HIGH o CRITICAL
approvabile

@matteocavo matteocavo merged commit b0fd14f into main Mar 25, 2026
5 checks passed
@matteocavo matteocavo deleted the feat/scout-url-user-agent branch March 25, 2026 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: scout-url — supporto User-Agent configurabile

2 participants